package com.dc.designPattern._23_specification.impl.step2.spec;

import com.dc.designPattern._23_specification.impl.step2.User;

import java.util.Objects;

/**
 * Description: 用户规格实现_用户名称相等
 * @author: gdc
 * @date: 2021/8/20
 * @version 1.0
 */
public class UserByNameEqual implements IUserSpecification {

    private String name;

    public UserByNameEqual(String name) {
        this.name = name;
    }

    @Override
    public boolean isSatisfiedBy(User user) {
        return Objects.equals(user.getName(), name);
    }
}
